package com.wzx.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class AccountDaoImpl implements IAccountDao {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Override
    public void update(String account, double v) {
       System.out.println(account+" "+v);
       jdbcTemplate.update("update account set money=money+? where `name`=?",v,account);
    }

    @Override
    public void translateOut(String account, double v) {
        jdbcTemplate.update("update account set money=money-? where `name`=?",v,account);
    }

    @Override
    public void translateIn(String account, double v) {
        jdbcTemplate.update("update account set money=money+? where `name`=?",v,account);
    }
}
